//
//  BaseViewController.m
//  Wetrip
//
//  Created by A5 on 14-9-15.
//  Copyright (c) 2014年 胡中磊. All rights reserved.
//

#import "BaseViewController.h"
@interface BaseViewController ()
@end
@implementation BaseViewController

//- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
//{
//    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
//    if (self)
//    {
//        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
//    }
//    return self;
//}

- (void)loadView
{

}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    RootViewController *root=(RootViewController *)self.tabBarController;
    [root setTabarHiend:YES];
    self.navigationController.navigationBarHidden=NO;
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//复写,改变导航栏背景
-(void)setTitle:(NSString *)title
{
    [super setTitle:title];
    
    UILabel *titleLable = [[UILabel alloc]initWithFrame:CGRectZero];
    titleLable.textColor = [UIColor blackColor];
    titleLable.font = [UIFont systemFontOfSize:17];
    titleLable.backgroundColor = [UIColor clearColor];
    titleLable.text = title;
    //适配高度
    [titleLable sizeToFit];
    self.navigationItem.titleView = titleLable;

//    UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
//    btn.frame=CGRectMake(0,0,60, 44);
//    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    [btn setTitle:@"返回" forState:UIControlStateNormal];
//    [btn addTarget:self action:@selector(getNavBack) forControlEvents:UIControlEventTouchUpInside];
//    
//    UIBarButtonItem *backItem=[[UIBarButtonItem alloc]initWithCustomView:btn];
//    self.navigationItem.leftBarButtonItem=backItem;
}
-(void)getNavBack
{
    [self.navigationController popViewControllerAnimated:YES];
}

@end
